package com.fx.zmlzml.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fx.zmlzml.entity.SysUserThirdParty;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
public interface SysUserThirdPartyMapper extends BaseMapper<SysUserThirdParty> {

    /**
     * 根据第三方ID和类型查询绑定关系
     */
    SysUserThirdParty selectByThirdPartyIdAndType(
            @Param("thirdPartyId") String thirdPartyId,
            @Param("thirdPartyType") String thirdPartyType
    );

    /**
     * 根据用户ID和第三方类型查询绑定关系
     */
    SysUserThirdParty selectByUserIdAndType(
            @Param("userId") Long userId,
            @Param("thirdPartyType") String thirdPartyType
    );

    /**
     * 根据用户ID查询所有第三方绑定
     */
    List<SysUserThirdParty> selectByUserId(@Param("userId") Long userId);

    /**
     * 解除用户与第三方账号的绑定
     */
    int unbindThirdParty(
            @Param("userId") Long userId,
            @Param("thirdPartyType") String thirdPartyType
    );
}